perm filename DMACS.TEA[UP,DOC] blob sn#411068 filedate 1979-03-06 generic text, type T, neo UTF8
You are looking at the DMACS tutorial.  Original authorship was by
Rubenstein@Sumex-AIM and McLure@SRI-KL.  This version has been
adapted for the DMACS command set by Agin@SRI-KL.

DMACS commands are generally prefixed by the CONTROL key or the META
(sometimes labelled EDIT) key.  Rather than write out META or CONTROL
each time we want you to prefix a character, we'll use the following
abbreviations:

 C-<char>	means hold the CONTROL key down and type a character.
 M-<char>    	means hold the META key down while typing a character.

Thus, C-F would be hold the control key and type F.  You will often
be asked to type characters to see how they work; don't actually do
this, however, until you see >> at the left of the screen.
For instance:
<<Blank lines inserted here by startup of TEACH-DMACS>>
>>  Now type M-\ (View next screen) to move to the next screen.
	(go ahead, do it by depressing the edit key and \ together).

Note that there is an overlap when going from screen to screen; this
provides some continuity when moving through the file.

The first thing that you need to know is how to move around from
place to place in the file.  You already know how to move forward a
screen, with M-\.  To move backwards a screen, type M-+ (depress the
edit key and type +.

>>  Try typing M-\ and then M-+ to move back and forth a few times.

SUMMARY
-------

The following commands are useful for viewing screenfuls:

	M-\	Move forward one screenful
	M-+	Move backward one screenful
	M-=	'Refresh' the current screen.

>> Try M-= now.  (You'll notice that it centers the screen where
   the cursor currently is.  If this happens to move this text off the
   screen, just do a M-\ to see it again.) Do a M-= for refresh.

BASIC CURSOR CONTROL
--------------------

Getting from screenful to screenful is useful, but how do you
reposition yourself within a given screen to a specific place?
There are several ways you can do this.  One way (not the best, but
the most basic) is to use the commands previous, backward, forward
and next.  As you can imagine these commands (which are given to
DMACS as M-↑, M-<, M->, and M-lf  respectively) move the cursor from
where it currently is to a new place in the given direction.  Here,
in a more graphical form are the commands:
 
			  Previous line, M-↑
				  :
				  :
   Backward, M-< .... Current cursor position .... Forward, M->
				  :
				  :
			  Next line, M-lf

These are the basic cursor positioning commands and you'll be using
them ALL the time so it would be of great benefit if you learn them
now.

>> Try doing a few M-lf's to bring the cursor down to this line.
   Move into the line with M-<'s and up with M-↑'s. Now use
   these four commands to play around a little. Try moving off
   the top of this screen and see what happens.

When you go off the top or bottom of the screen, the text beyond
the edge is shifted onto the screen so that your instructions can
be carried out while keeping the cursor on the screen.

A faster way to move around is to move by words or even entire
sentences.   Here is a summary of simple moving operations including
the word and sentence moving commands:

	M->	Move forward a character
	M-<	Move backward a character
	M-)	Move forward a word
	M-(	Move backward a word

	M-lf	Move to next line
	M-↑	Move to previous line

	M-[	Move to beginning of line
	M-]	Move to end of line

	M-B	Move back to beginning of sentence
	M-F	Move forward to end of sentence

	M-{	Go to beginning of file
	M-}	Go to end of file

>> Try all of these commands now a few times for practice.
   Since the last two will take you away from this screen,
   you can come back here with M-+'s and M-\'s.  These are
   the most often used commands.

Like all other commands in DMACS, these commands can be given
arguments which cause them to be executed repeatedly.  The way you
give arguments is by prefixing  with M- the number of times you want
it repeated.  For instance, M-8 M-> moves forward eight characters.
	
>> Try giving a suitable argument to M-lf or M-↑ to come as close
   as you can to this line in one jump.

The only apparent exception to this is the screen moving commands,
M-\ and M-+.  When given an argument, they scroll the screen up or
down by that many lines, rather than screenfuls.  This proves to be
much more useful.

>> Try typing M-8 M-\ now.

Did it scroll the screen up by 8 lines?  If you would like to
scroll it down you can give an argument to M-+.


INSERTING AND DELETING
----------------------

If you want to type text, just do it.  Characters which you can see,
such as A, 7, *, etc. are taken by DMACS as text and inserted
immediately.  You can delete the last character you typed by doing
<Delete>.  More generally, <Delete> will delete the character immediately
before the current cursor position.

>> Do this now, type a few characters and then delete them
   by typing <Delete> a few times.

Remember that most DMACS commands can be given a repeat count;  Note
that this includes characters which insert themselves.

>>  Try that now -- type M-8 * and see what happens.

You've now learned the most basic way of typing something in
DMACS and correcting errors.  You can delete by words or lines
as well.  Here is a summary of the delete operations:

	<Delete>     delete the character just before the cursor
	M-D   	     delete the next character after the cursor
	C-M-D	     kill the next word after the cursor
	M-K	     kill from the cursor position to end of line
	M-<Delete>   kill the word immediately before the cursor

Now suppose you kill something, and then you decide that you want to
get it back?  Well, whenever you kill something bigger than a
character, DMACS saves it for you.  To uNkill it back, use M-N.  Note
that you don't have to be in the same place to do M-N;  This is a
good way to move text around.  Also note that the difference between
"Killing" and "Deleting" something is that "Killed" things can be
uNkilled back, and "Deleted" things cannot.

For instance, type M-lf a couple times to postion the cursor
at some line on this screen.

  >> Do this now, move the cursor and kill that line with M-K.

Note that a single M-K will kill the contents of the line, and a
second M-K will delete the line itself, and make all the other lines
move up.  If you give M-K a repeat count, it will delete that many
lines AND their contents.

The text that has just disappeared is saved so that you can
retrieve it.  To retrieve the last killed text and put it where
the cursor currently is type M-N.

 >> Try it; type M-N to uNkill the text back.

Think of M-N as if you were uNkilling something back that someone
took away from you.  Notice that if you do several M-K's all at once
the text that is killed is all saved for you so that if you  want
it back you can uNkill it back.

 >> Do this now, type M-K several times.

Now to retrieve that killed text:

 >> Move the cursor down a few lines and type M-N to retrieve the
	lines that you killed.  This is how you move text from place
	to place.  You can even make copies of a line by killing it
	and uNkilling it back as many times as you want. Remember
	that when you have just killed text, it stays with you so
	that if you move your cursor elsewhere in the text and
	then M-N to uNkill back the killed text, you will have 
	a method for moving text around in a file.


MODE LINE
---------

If DMACS sees that you are typing commands slowly it shows them to
you at the bottom of the screen in an area called the echo lines.
This is just the last few lines at the bottom.  The line immediately
above these is called the MODE LINE.  You may notice that it begins
with DMACS (Text) ...more stuff...  This is a very useful
'information' line.  To understand DMACS it is best to consider that
it operates in a variety of modes.  The default mode is Text which is
what you are in now.  There are modes for editing different languages
and text, such as LISP mode, SAIL mode, etc.  The mode line serves to
show you various things about your current state.  For instance, on
the mode line here you'll notice that it says Main.  DMACS operates
with things called buffers.  This is a place that it puts your file
while you are editing it.  There are names for buffers.  The default
buffer upon startup of DMACS is Main.  You'll notice that after the
Main and before the --nn%-- comes the filename DSK:<your directory>
TEACH-DMACS.TUTORIAL.  This is the name of your own temporary copy of
the text of the DMACS tutorial; the file you are now visiting.


SEARCHING
---------

DMACS can do searches for strings (these are groups of
contiguous characters or words) either forward through the
file or backward through it. To search for the string
means that you are trying to locate it somewhere in the
file and have DMACS show you where the occurences of the
string exist.  This type of search is somewhat different
from what you may be familiar with.  It is a search that
is performed as you type in the thing to search for.  The
command to inititate a search is C-M-S for forward search,
and C-M-R for reverse search.  BUT WAIT!  Don't do them now.
When you type C-M-S you'll notice that the mode line changes
to 'I-Search' and below it you get 'Search:' This tells
you that DMACS is in what is called an incremental search
waiting for you to type the thing that you want to search
for.

>>  Now type C-M-S to start a search.  SLOWLY, one letter at a time,
	type the word 'cursor', pausing after you type each
	character to notice what happens to the cursor.

Did you see what happened?  DMACS, in an incremental search, tries
to go to the occurence of the string that you've typed out so far.
To go to the next occurence of 'cursor' just type M-S.  If no
such occurence exists DMACS beeps and tells you that it is a failing
search.  To get out of a search tell DMACS that you want to stop
searching with <ESC>.  More generally, DMACS can be told to stop
whatever it is doing with C-G so you could also type C-G.

If you are in the middle of an incremental search and type <Delete>,
you'll notice that the last character in the search string is erased
and the search backs up to the previous occurence of that string. For
instance, suppose you currently have typed 'cu' and you see that your
cursor is at the first occurence of 'cu'. If you now type <Delete>,
the 'u' on the search line is erased and you'll be repositioned in the
text to the occurence of 'c' immediately before the first 'cu'. This
provides a useful means for backing up while you are searching. Also,
if you are in the middle of a search and happen to type a control
character, the cursor will go back to the place where you originally
started the search.

The C-M-S starts a search that looks for any occurence of the search
string AFTER the current cursor position.  But what if you want to
search for something earlier in the text?  To do this one should
type C-M-R for Reverse search.  Everything that applies to C-M-S applies
to C-M-R except that the direction of the search is reversed.


EXTENDING THE COMMAND SET
-------------------------

There are many, many more DMACS commands than could possibly be put
on all the control and meta characters.  DMACS gets around this with
the X (eXtend) command.  This comes in two flavors:

	C-X	Character eXtend
	M-X	Character eXtend

C-X or M-X is always followed by another character that tells what to
do.  The second character may or may not require the CONTROL key,
depending on the command.  But the META key never has any effect.

There are many C-X commands.  The ones you need immediately are:

	C-X C-V		Visit file.  This is how you read in a file
			to edit it.  When you type this, DMACS asks
			you for a file name to visit.  You would respond
			with the name of the file.  Then DMACS brings it
			in for editing.  If the file doesn't exist, then
			DMACS assumes that you are creating a new file.
	C-X C-S		Save file.  This is a command that tells DMACS
			to save the file you are currently looking at
			onto disk.  It is recommended you give this
			ocassionally to prevent losing any work in the
			case of a system crash.

There is another way to extend the DMACS command set:

	C-M-X	Named command eXtend

Named eXtend commands are commands which are used even less
frequently, or commands which are used only in certain modes.  An
example of this type of command is the Replace command.  When you
type C-M-X, DMACS will prompt you at the bottom of the screen with MM
(DMACS calls named eXtend commands MM commands) and then you can
type the name of the command you want to execute, in this case,
"Replace String".  Just type "REP<esc>" and DMACS will complete the
command.  Then you type the string that you want to replace, an
<esc>, the string you want to replace it with, and a return.

 >> Try this now;  type C-M-X rep<esc>try<esc>you can do<return>
	See how the previous line changed?  All the "try"s were
	changed to "you can do"

GETTING MORE HELP
-----------------

In this tutorial we have tried to supply just enough information to
get you started using DMACS.  There is so much available in DMACS that
it would be impossible to explain it all here.  However, you may want
to learn more about DMACS since it has numerous desirable features
that you don't know about yet.  DMACS has a great deal of internal
documentation.  All of these commands can be accessed through the HELP
character, which is the <HOLD> key on Datamedia terminals.  To use
the HELP features, type the <HELP> character, and then a character
saying what kind of help you want.  If you are REALLY lost, type
<HELP> ?  and DMACS will tell you what kinds of help it can give.
The options which are most useful are the following:

 	<HELP> C	Character describe.  You type in the character.
			Multi-character commands such as C-X C-Z
			and <ESC>V are also allowed.
	<HELP> D	Describe a named command.  You type in a command.
	<HELP> A	Apropos.  Type in a keyword and DMACS will
			list all the commands containing that keyword.
			More than one keyword can be specified,
			seperated by C-O
	<HELP> I	Run the INFO program.  INFO contains the
			complete documentation for DMACS, in 
			great detail.  Here is where you can find out
			about, for instance, special commands for editing
			LISP code, handling buffers, replacing text, filling
			and justifying text, etc.

 >> Go ahead and try some of these.  Type <HELP> C M-K.  DMACS will tell
	you what that character does.  Try typing <HELP> A WORD to find
	out all the commands that have to do with words.  When DMACS
	prompts you with --MORE--, type a space to see more or a C-N
	to get your text back.  INFO is a fairly sophisticated
	documentation finder and is somewhat complicated.  It probably
	isn't a good idea to try to use INFO just yet. Use DMACS for
	a few days, gain some familiarity and confidence in giving
	commands. And then try INFO out.

Another really valuable help is the file <EMACS>DMACS.CHART.  It
lists all the commands available in DMACS.  List the file on the line
printer using the exec command LLIST instead of LIST, because it's
formatted for wide paper.  Don't try to learn everything on the chart
at once, but when you learn a new command, DO see where it's
mentioned in the chart to help fix the command in your mind.

CONCLUSION
----------

You'll probably find that if you use DMACS for a few days you won't
be able to give it up.  Initially it may give you trouble.  But remember
that this is the case with any editor, especially one that can do many,
many things.  And DMACS can do practically everything.